"""
@author: yjx
@file: 函数是否存在.py
@time: 2023/5/21 12:31
"""

class A:
    def __init__(self):
        pass

    # 要验证的函数
    @staticmethod
    def func1():
        print("this is fun1")

    # 要验证的函数
    @staticmethod
    def func2():
        print("this is func2")

    def check(self, f):
        if hasattr(self, f):
            print("函数已经存在")
        else:
            print("函数名不存在")



f = input("想要检索的函数：")

a = A()
a.check(f)

